from django import forms
from project.travel_game.models import Profession, Party
import random
import datetime

class teamInfoForm(forms.Form):
    '''
        The default names inserted into the teamInfoForm.
        If the user doesn't choose new names, these become the names they play
        through the game with.
    '''
    names = ['Linus Torvalds','Guido van Rossum','James Gosling',
                 'Bjarne Stroustrup', 'Adrian Holovaty', 'Simon Willison', 
                 'Jacob Kaplan-Moss','Wilson Miner','Malcolm Tredinnick',
                 'Russell Keith-Magee','Joseph Kocherhans','Luke Plant',
                 'Brian Rosner','Gary Wilson','Justin Bronn','Karen Tracey',
                 'Jannis Leidel','James Tauber','Alex Gaynor','Andrew Godwin',
                 'Carl Meyer','Ramiro Morales','Chris Beaven','Honza Kral',
                 'Idan Gazit','Paul McMillan','Julien Phalip','Aymeric Augustin'
                 ]
    random.shuffle(names)
    # Setting up forms to take input so that the user can select his party
    # members and profession
    mainCharacter = forms.CharField(label="Team Leader",initial=names[0],required=False)
    teamMember1 = forms.CharField(label="First Member",initial=names[1],required=False)
    teamMember2 = forms.CharField(label="Second Member",initial=names[2],required=False)
    teamMember3 = forms.CharField(label="Third Member",initial=names[3],required=False)
    teamMember4 = forms.CharField(label="Fourth Member",initial=names[4],required=False)
    profession = forms.ModelChoiceField(empty_label=None,
                                        queryset=Profession.objects.all(),
                                        widget=forms.RadioSelect,
                                        label="Profession")
    # Pace and rations choices are initialized here and can be updated later
    paceChoices = (
        (3,'Grueling'),
        (2,'Brisk'),
        (1,'Slow')
    )
    rationChoices = (
        (3,'Filling'),
        (2,'Normal'),
        (1,'Meager')
    )
    rations = forms.ChoiceField(choices=rationChoices)
    pace = forms.ChoiceField(choices=paceChoices)
    startDate = forms.DateField(initial="08/01/1855")
    
class paceForm(forms.Form):
    '''
        User selects starting pace using radio buttons
    '''
    paceChoices = (
        (3,'Grueling'),
        (2,'Brisk'),
        (1,'Slow')
    )
    pace = forms.ChoiceField(choices=paceChoices)
    
class rationForm(forms.Form):
    '''
        User selects starting rations
    '''
    rationChoices = (
        (3,'Filling'),
        (2,'Normal'),
        (1,'Meager')
    )
    rations = forms.ChoiceField(choices=rationChoices)
    
class userCreationForm(forms.Form):
    '''
        User enters login info that they can use to maintain a game over 
        multiple sessions
    '''
    username = forms.CharField(label="Create username")
    email = forms.EmailField(label="Email")
    password = forms.CharField(widget=forms.PasswordInput,label="Create password")